import pandas as pd

def macd(data, n_fast=12, n_slow=26, n_signal=9):
    ema_fast = data['close'].ewm(span=n_fast, adjust=False).mean()
    ema_slow = data['close'].ewm(span=n_slow, adjust=False).mean()
    macd_line = ema_fast - ema_slow
    signal_line = macd_line.ewm(span=n_signal, adjust=False).mean()
    histogram = macd_line - signal_line
    result = pd.DataFrame({
        'macd': macd_line,
        'signal': signal_line,
        'histogram': histogram,
    })
    return result

def macd_cross(data, n_fast=12, n_slow=26, n_signal=9):
    df = macd(data, n_fast, n_slow, n_signal)
    crosses = []
    
    for i in range(1, len(df)):
        prev_macd = df['macd'].iloc[i-1]
        curr_macd = df['macd'].iloc[i]
        prev_signal = df['signal'].iloc[i-1]
        curr_signal = df['signal'].iloc[i]
        
        if (prev_macd < prev_signal) and (curr_macd > curr_signal):
            crosses.append((i, 'gold')) 
        elif (prev_macd > prev_signal) and (curr_macd < curr_signal):
            crosses.append((i, 'dead'))
    return crosses
